﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.TP
{
    class Class3
    {
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.Age < 65 && (ppa.Period + 1) % 2 == 0)
            {
                int x = ppa.Period / 10 + 1;

                double f = 0.05 * x > 0.2 ? 0.2 : 0.05 * x;

                da.Value = ppa.Amount * f;
                
            }
            else if(ppa.Age >=65 && ppa.Age<=88)
            {
                da.Value = ppa.Amount * 0.3;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                if (ppa.Age < 65)
                {
                    da.Value = ppa.TotalFee;
                }
                else
                {
                    double s = (ppa.Age - 65 + 1) * ppa.Amount * 0.3;
                    double s2= ppa.Amount-s>0? ppa.Amount-s:0;

                    da.Value = s2;
                }
                ppa.IsCurrentFinish = true;
            }


        }
    }
}
